package com.wx.wxpush;

import com.spring4all.swagger.EnableSwagger2Doc;
import org.apache.catalina.connector.Connector;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@SpringBootApplication
@MapperScan(basePackages = "com.wx.wxpush.mapper")
@EnableScheduling
@EnableAsync

public class WxpushApplication {

	public static void main(String[] args) {

		SpringApplication.run(WxpushApplication.class, args);
	}
	@Bean
	public ServletWebServerFactory servletContainer() {
		TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
		tomcat.addAdditionalTomcatConnectors(createHTTPConnector());
		return tomcat;
	}

	private Connector createHTTPConnector() {
		Connector connector = new   Connector("org.apache.coyote.http11.Http11NioProtocol");
		//同时启用http（8080）、https（8443）两个端口
		connector.setScheme("http");
		connector.setSecure(false);
		connector.setPort(8189);
		connector.setRedirectPort(5700);
		return connector;
	}


}
